import React, { useState, useEffect } from 'react';
import { Form, Input, Modal, Row, Button } from 'antd';
const { TextArea } = Input;
import { FormValueType } from '../data.d';

const FormItem = Form.Item;

export interface UpdateFormProps {
    typelist?: API.DictItem[];
    onCancel: () => void;
    onSubmit: (values: FormValueType) => void;
    updateModalVisible: boolean;
    values?: FormValueType;
}

const formLayout = {
    labelCol: { span: 5 },
    wrapperCol: { span: 15 },
};

const UpdateForm: React.FC<UpdateFormProps> = (props) => {
   
    const [form] = Form.useForm();
    const { updateModalVisible, onSubmit: handleUpdate, onCancel } = props;

    const okHandle = async () => {
        const fieldsValue = await form.validateFields();
        
        form.resetFields();
        handleUpdate(fieldsValue);
    };




    return (
        <Modal
            width={640}
            maskClosable={false}
            destroyOnClose
            title="巡检记录确认"
            visible={updateModalVisible}
            onOk={okHandle}
            onCancel={() => onCancel()}
        >
            <Form
                {...formLayout}
                form={form}
                initialValues={{ }}
            >
              
                <FormItem
                    label="处理意见"
                    name="comment"
                >
                    <TextArea placeholder="请输入" showCount maxLength={100} />
                </FormItem>
              
            </Form>
        </Modal>
    );
};

export default UpdateForm;
